package com.learn;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 注入数组和集合
 * @author Romanceling
 *
 */
@Component
@PropertySource("classpath:listArray.properties")
@ConfigurationProperties(prefix="la")
public class ListArrayConfig {

	private String[] ports;
	
	private 
	List<String> hosts = new ArrayList<>();

	public String[] getPorts() {
		return ports;
	}

	public void setPorts(String[] ports) {
		this.ports = ports;
	}

	public List<String> getHosts() {
		return hosts;
	}

	public void setHosts(List<String> hosts) {
		this.hosts = hosts;
	}

	@Override
	public String toString() {
		return "ListArrayConfig [ports=" + Arrays.toString(ports) + ", hosts=" + hosts + "]";
	}

}
